package com.chookss.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chookss.R;
import com.chookss.tools.Utils;

public class WaterMaskView extends RelativeLayout {

    private TextView tvGroup;
    private TextView tvName;
    private TextView tvTime;
    private LinearLayout llAddress;
    private TextView tvAddress,tvNameJd,tvNameWd;


    public WaterMaskView(Context context) {
        this(context, null);
    }

    public WaterMaskView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.layout_water_mask, this, true);
        tvGroup = (TextView) findViewById(R.id.tvGroup);
        tvName = (TextView) findViewById(R.id.tvName);
        tvTime = (TextView) findViewById(R.id.tvTime);
        llAddress = (LinearLayout) findViewById(R.id.llAddress);
        tvAddress = (TextView) findViewById(R.id.tvAddress);
        tvNameJd = (TextView) findViewById(R.id.tvNameJd);
        tvNameWd = (TextView) findViewById(R.id.tvNameWd);

    }

    public void setGroup(String group) {
        tvGroup.setText(group);
    }
    public void setTime(String time) {
        tvTime.setText(time);
    }
    public void setName(String name) {
        tvName.setText(name);
    }
    public void setAddress(String address) {
        if(Utils.isNull(address)){
            llAddress.setVisibility(View.GONE);
        }else{
            tvAddress.setText(address);
            llAddress.setVisibility(View.VISIBLE);
        }
    }
    public void setLoc(String xunjianJd,String xunjianWd) {
        if(!Utils.isNull(xunjianJd)&&!Utils.isNull(xunjianWd)){

            tvNameJd.setText("经度："+Utils.getAddressLoc(xunjianJd));
            tvNameWd.setText("纬度："+Utils.getAddressLoc(xunjianWd));
            tvNameJd.setVisibility(View.VISIBLE);
            tvNameWd.setVisibility(View.VISIBLE);
        }else{
            tvNameJd.setVisibility(View.GONE);
            tvNameWd.setVisibility(View.GONE);
        }
    }
}
